import highlight from 'highlight.js'

export const markdown = require('markdown-it')({
  highlight(str: string, lang: string) {
    if (lang && highlight.getLanguage(lang)) {
      try {
        return highlight.highlight(str, { language: lang }).value
      } catch (__) {}
    }
    return ''
  }
})
